package Engine;
import java.net.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import Classes.*;
public class Engine {
    
    static String studentName;
    static String testName;
    static int endHour;
    static int endMinute;
    static long endTime;
    
    static boolean connectedToServer = false;
    static String serverIp;
    
    public static void doLogin(String newStudentName) {
        studentName = newStudentName;
        new Gui.TestWindow();
    }
    
    /* most probably OBSOLETE due to non-automatic server ip searching
    
    public static boolean tryServerHandshake() {
        try {
            ServerSocket listen = new ServerSocket(1234);
            Socket client = listen.accept();
            InputStream in = client.getInputStream();
            OutputStream out = client.getOutputStream();
            ObjectInputStream incomingObject = new ObjectInputStream(in);
            client.close();
            
            if(incomingObject.getClass().equals("Handshake")) {
                return true;
            }
            return false;
            
        } catch(IOException ioe) {
            JOptionPane.showMessageDialog(null,"input-output error");
        }
        return false;
    }
     */
    
    public static void doLoadTestDetails(String newTestName,int newMinutesToEnd) {
        testName = newTestName;
        endTime = System.currentTimeMillis()+(newMinutesToEnd*6000);
    }
    
    public static String getStudentName() {
        return studentName;
    }
    
    public Engine() {
    }
}
